<?php

namespace Mlym\CodeGeneration\InitGeneration\Authorization\Method;

use EasySwoole\EasySwoole\Config;
use Mlym\CodeGeneration\ClassGeneration\MethodAbstract;

class Construct extends MethodAbstract
{
    function addMethodBody()
    {
        $this->classGeneration->getPhpNamespace()->addUse(Config::class);
        $this->method->setBody(<<<BODY
\$config = Config::getInstance()->getConf('JWT');
\$this->secretKey = \$config['secretKey'] ?? '';
\$this->dataFields = \$config['dataFields'] ?? '';
\$this->ignoreAction = \$config['ignoreAction'] ?? [];
BODY
            );
    }

    function getMethodName(): string
    {
        return '__construct';
    }
}